package com.zilu.digitaltwin.dto.req;

import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;

import javax.validation.constraints.NotBlank;
import java.util.Arrays;

/**
 * @ClassName: EntityByNumberAttributeReqDTO
 * @Description:
 * @Author: 段振宇
 * @Date: 2023/1/7 13:35
 */
@Data
public class EntityByNumberAttributeReqDTO extends NumberAttributeReqDTO{

    @JsonProperty("range")
    @NotBlank(message = "range不能为空")
    private String range;

    private Integer zoom;

    public EntityObjectQuery convertToQueryDto(){
        EntityObjectQuery entityObjectQuery = new EntityObjectQuery();
        entityObjectQuery.setBounds(this.range);
        entityObjectQuery.setCodes(Arrays.asList(this.getEntityType().split(",")));
        entityObjectQuery.setZoom(this.zoom);
        return entityObjectQuery;
    }
}
